/*/////////////////////////////////////////////////////////////////////////////
/
/
/////////////////////////////////////////////////////////////////////////////*/
#ifndef WEAPONS_H
#define WEAPONS_H


#ifdef WIN32
#pragma once
#endif

#include "items.h"


const enum
{
	unarmed=0, dagger, axe, sword, polearm, ranged
} CWEAPONTYPE;

const enum
{
	swing=0, Wequip, Wunequip, Wsell, buy, Wuse_magic, poison /* only certain classes */
} CWEAPONACTION;

class cWeapon : public cItem
{
private:
	// mType 0 is unarmed, 1 is dagger, 2 is axe, 3 is sword, 4 is polearm, 5 is ranged,
	int mNumofDice;
	int mDamage;
	int mCritical;
	int mCritMod;
	int mCurrentCount;
	int mMaxCount;
	int mMagicModifier;
	bool isMagic;
	bool isRanged;
	bool isThrowable;
	string mMagicDescription;
	string mMagicName;
public:
	cWeapon();
	cWeapon( string name, string desc, int type, int value, int dice, int damage, int critcal, int critmod, int curcount, int maxcount,
		bool magic, bool ranged, bool throwable, bool twoh, bool heavy, bool sell);
	~cWeapon();
	virtual bool Use(string sAction);

	// Accessors
	const int getDice() { return mNumofDice; }
	const int getDamage(){ return mDamage; }
	const int getCritical(){ return mCritical; }
	const int getCritMod() { return mCritMod; }
	const int getCurCount() { return mCurrentCount; }
	const int getMaxCount() { return mMaxCount; }
	const bool getMagic() { return isMagic; }
	const bool getRanged() { return isRanged; }
	const bool getThrowable() { return isThrowable; }
	const string getMagicDesc() { return mMagicDescription; }
	const string getMagicName() { return mMagicName; }
	const int getMagicMod() { return mMagicModifier; }

	void setDice( int num ) { if ( num > 0 && num < 4 ) mNumofDice = num; } // not a typo, for easy expansion
	void setDamage( int num ){ if (num > 0) mDamage = num; }
	void setCritcal( int num) { if ( num > 17 && num < 21 ) mCritical = num; }
	void setCritMod( int num) { if ( num > 1 && num < 5 ) mCritMod = num; }
	void setCurCount( int num) { if( num > 0) mCurrentCount = num; }
	void setMaxCount( int num) { if ( num > 0 && num >= mCurrentCount ) mMaxCount = num; }
	void setMagic( bool tmp ) { isMagic = tmp; }
	void setRanged( bool tmp ) { isRanged = tmp; }
	void setThrowable( bool tmp ) { isThrowable = tmp; }
	void setMagicName( string tmp ) { mMagicName = tmp; }
	void setMagicDesc( string tmp ) { mMagicDescription = tmp; }
	void setMagicMod( int tmp ) { mMagicModifier = tmp; }
};

#endif